// const plugins = require.context('/tinymce/plugins', true, /\.js$/);
export default class editorConfig {
	constructor(target, options, callback) {
		this.#initializeEditor(target, options, callback);
	}

	#initializeEditor(target, options, callback) {
		let tinyConfig = {
			target,
			skin: 'oxide',
			suffix: '.min',
			menubar: false,
			statusbar: false,
			auto_focus: true,
			language: 'zh_CN',
			base_url: '/tinymce',
			content_style: 'p { margin: 10px 0; }',
			content_css: '/tinymce/skins/ui/oxide/content.min.css',
			...options
		};
		tinymce.init({
			...tinyConfig,
			setup: (editor) => {
				if (!!callback && typeof callback === 'function') {
					// callback.call(this, editor);
				}
			}
		});
	}

	handleImageUpload(blobInfo, success, failure) {
		console.log(blobInfo, success, failure);
		success('123123');
	}
}